I-Spy Bits and Pieces

I-Spy is an AppleScript applet which invokes and controls several Perl scripts, applications, scripting additions, and a library:

Note: Most URLs below point to directories rather than the actual files. While new versions arrive and people change file names, directories tend to persist longer.

Perl scripts

AppleScript is rather ill-attuned as a text processing tool. As discovery of new items depends on finding differences between text files, I decided to delegate most text processing to MacPerl. In addition to optional filter scripts, I-Spy relies on the following to process directory lists:

Sort file.pl [supplied]

Once I-Spy obtains a list of files, it sorts the list to facilitate the comparison script invoked next. As insurance, the old list is also sorted, even though it is still likely sorted from the previous run of I-Spy.

Find different lines.pl [supplied]

I-Spy compares old and new file list snapshots and segregates lines from both files into Lines added, Lines removed, and Lines retained. The first file is of further interest to us, while the other two remain for debugging and general user inspection.

Filter and concatenate FTP.pl [supplied]

Filter and concatenate HTML.pl [supplied]
I-Spy chooses an appropriate script of these two depending on the transport mode selected. It then iterates through all the viable site folders, and filters and aggregates lines from each Lines added file into New files.

Note: I-Spy expects that these scripts reside in the same folder as it does.


Applications

Anarchie [required]

I-Spy relies on Anarchie to both download files and to generate directory listings of FTP sites under observation. I last successfully tested I-Spy with Anarchie 1.6.0, which should be available in the comm/tcp/ directory of Info-Mac.

You may substitute Fetch 3.x, as Fetch now supports an Anarchie compatible AppleScript dictionary. However, my results with Fetch 3.0 were rather inconsistent.

ICScriptor [required]

I-Spy queries on ICScriptor to identify your web browser, and then uses this information to set the owner of the New files file if the HTML transport is selected. I last successfully tested I-Spy with ICScriptor 1.0b1, which should be available in the dev/osa/ directory of Info-Mac.

ICScriptor in turn relies on Internet Config to obtain your web browser preferences. Internet Config 1.2 is the latest release version as I write this, and it should be available in the comm/tcp/ directory of Info-Mac.

Finder [required]

While most of what the Scriptable Finder does may be achieved with available scripting additions, the Finder simply seems a more elegant solution. Thus, I-Spy relies on the Finder for a few operations. There is no easy manner to get a Scriptable Finder other than to install a MacOS release that contains it. I developed and tested I-Spy under MacOS 7.5.1.

MacPerl [required]

MacPerl is the engine I-Spy invokes to execute all its Perl scripts. I use beta releases of MacPerl 5.x with I-Spy. As most beta releases, MacPerl 5.x exhibits some quirks. All of the current Perl scripts will run under MacPerl 4.1.8 which should be available in the dev/ directory of Info-Mac, but I have noticed problems with that release as well.

Progress Bar [optional]

I-Spy may take quite a while to do its business. Constantly opening and refreshing the log file grew tiresome; so, I decided to wire in a progress bar dialog. Progress Bar is an application designed to provide just this service for an AppleScript applet or script. I last successfully tested I-Spy with Progress Bar 1.0.1, which should be available in the dev/osa/ directory of Info-Mac. However, I-Spy will run just fine without this helper, but make sure to learn about possible problems should you choose to skip Progress Bar.


Scripting Additions

AppleScript itself is rather limited to controlling scriptable applications; however, its vocabulary of commands is easily expanded by scripting additions. I-Spy expects the ones descrived below:

Core AppleScript Additions [required]

AppleScript itself ships with a bunch of additions, and I-Spy relies on some of them. If you have AppleScript, then you have these additions. If you don't, well, you'll have to get it before you can use I-Spy ;-).

ACME Script Widgets [required]

While I-Spy delegates most text parsing to MacPerl, it still does a few things internally. I-Spy relies on Tokenize, Join, and Replace to help out with string parsing. I still use the original release additions which were free (I think). Currently, you may find a shareware version (Acme Script Widgets 2.5.1) in the dev/osa/ directory of Info-Mac.

Jon's Commands [required]

I-Spy calls upon Jon's Commands for a few file access routines. Jon's Commands 1.4 should be available in the dev/osa/ directory of Info-Mac.

Late Night Software Suite [required]

I-Spy uses File IO and Processes from this suite of additions. Freeware Script Tools 1.3.1 may be found in the dev/osa/ directory of Info-Mac. A payware version renamed Late Night Software Suite 1.4.1 is bundled with Script Debugger 1.0.4.


Library

AppleScript supports inheritance, and, thus, a nifty method for building on top of simpler scripts. I segregated a number of handlers that I use in most of my scripts into the library described below:

Tiny [required]

I-Spy inherits most of the log file and error handling functionality from this library. Tiny also provides mechanisms for learning about working directories, handling user interrupts, and cleaning up before quitting. Tiny 1.0.4 should be available in the dev/osa/ directory of Info-Mac.


Return to the table of contents.
ISL [12/29/95]